//
//  ViewController.m
//  UI02 __第二题
//
//  Created by 洛洛大人 on 16/6/6.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"
#import "llSlider.h"
@interface ViewController ()
@property(nonatomic, retain)UIImageView *imageView;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatImageView];
}


-(void)creatImageView {
   
    UIImage *image = [UIImage imageNamed:@"BackGround.png"];
    
    self.imageView = [[UIImageView alloc] initWithImage:image];
    self.imageView.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:self.imageView];
    
    llSlider *LLSlider = [[llSlider alloc] init];
    LLSlider.frame = CGRectMake(100, 550, 200, 50);
    [self.view addSubview:LLSlider];
 
    [LLSlider addTarget:self action:@selector(sliderAction:) forControlEvents:UIControlEventValueChanged ];
    
    
      [self.imageView release];
      [LLSlider release];
    
}



-(void)sliderAction:(llSlider *)slider {

    self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BZombie1.tiff"]];
    self.imageView.frame = CGRectMake(70, 100, 350, 250);
    [self.view addSubview:self.imageView];

    NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:25];
    for (int i = 1; i <= 25; i++) {
        NSString *name1 = [NSString stringWithFormat:@"BZombie%d.tiff",  i];
        UIImage *animationImage = [UIImage imageNamed:name1];
        [mutableArray addObject:animationImage];
    }
    self.imageView.animationImages = mutableArray;
    
    self.imageView.animationDuration = slider.value;
    [self.imageView startAnimating];
    
    [self.imageView release];
    
}











- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
